#include <iostream>

using namespace std;

const int N = 1e5 + 10;

int n;
int a[N];
int tmp[N]; // 辅助归并排序时，合并两个有序数组

//思路：
//1.只要能分，就将整个区间从中间一分为二，先将左区间和右区间排序
//2.然后将左右两个已经排好序的区间合并在一起
void merge_sort(int left, int right)
{
	if(left >= right) return;

	//1.先一分为二，划分左右区间
	int mid = (left + right) >> 1;
	//[left, mid] [mid + 1, right]
	
	//2.先让左右区间有序
	merge_sort(left, mid);
	merge_sort(mid + 1, right);

	//3.合并两个有序数组
	int cur1 = left, cur2 = mid + 1, i = left;
	while(cur1 <= mid && cur2 <= right)
	{
		if(a[cur1] < a[cur2]) tmp[i++] = a[cur1++];
		else tmp[i++] = a[cur2++];
	}

	while(cur1 <= mid) tmp[i++] = a[cur1++];
	while(cur2 <= right) tmp[i++] = a[cur2++];

	//4.拷贝到原数组
	for(int j = left; j <= right; j++)
	{
		a[j] = tmp[j];
	}
}

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];	
	
	merge_sort(1, n);
	
	for(int i = 1; i <= n; i++) cout << a[i] << " ";	
	
	return 0;
}

